<template>
  <div class="senior">
    
    <!-- 1.单行文本组件 type = text  -->  
    <a-row type="flex" v-if="componentsObject.searchType === 'DrugBaseInput' " style="margin-top: 15px;">
      <a-col flex="160px" style="text-align: right; line-height: 32px;">
        <span>{{ componentsObject.title }}：</span>
      </a-col>
      <a-col flex="auto">
        <a-input :placeholder="componentsObject.placeholder" v-model="seniorValue" />
      </a-col>
    </a-row>
    
    <!-- 2.数字框组件 type = number -->   
    <a-row type="flex" v-if="componentsObject.searchType === 'DrugBaseNumber'" style="margin-top: 15px;">
      <a-col flex="160px" style="text-align: right; line-height: 32px;">
        <span>{{ componentsObject.title }}：</span>
      </a-col>
      <a-col flex="auto">
        <a-input-number id="inputNumber" :min="0" :max="99999" v-model="seniorValue" />
      </a-col>
    </a-row>

    <!-- 3.文本域组件 type = number -->   
    <a-row type="flex" v-if="componentsObject.searchType === 'DrugBaseTextarea'" style="margin-top: 15px;">
      <a-col flex="160px" style="text-align: right; line-height: 32px;">
        <span>{{ componentsObject.title }}：</span>
      </a-col>
      <a-col flex="auto">
        <a-textarea :rows="4" :placeholder="componentsObject.placeholder" v-model="seniorValue" />
      </a-col>
    </a-row>
    
  </div>
</template>

<script>

export default {
  name: 'SeniorForm',
  props:{
    componentsObject: Object
    /**
     * componentsObject:{
     *  title: '标题',         //  汉语标题
     *  keys: 'test',          //  英文字段名称
     *  placeholder: '请输入', //  placeholder 
     *  type: 'text',          //  类型
     *  value: '万三',         //  值  
     * } 
     */
  },
  components:{
   
  },
  data(){
    return{
      seniorValue: '',
    }
  },

  created(){
    
  },

  mounted(){
    this.seniorValue = this.componentsObject.seniorValue?this.componentsObject.seniorValue:null
  },

  methods: {

  },

  watch: {
   seniorValue(val, oldVal){
      let obj = {
        currentVal: val,
        keys: this.componentsObject.keys,
      }
      this.$emit("seniorValueReturn", obj)
    }
  }
}
</script>


<style lang="less" scoped>
</style>
